"use strict";

/**
 * @ngdoc function
 * @name jgappApp.controller:ProjectChooseprojectCtrl
 * @description
 * # ProjectChooseprojectCtrl
 * Controller of the jgappApp
 */
angular
  .module("jgappApp")
  .controller("ProjectChooseprojectCtrl", function(
    $scope,
    Util,
    openApi,
    PagingService,
    localStorageService
  ) {
    var param = {};
    // 选择后回传的数据
    $scope.choosePeople = function(index) {
     var item= $scope.taskList.items[index]     
      //当用户选择后将选中记录的部分值回传到发起流程的界面

      // pkId -> projectId

      // fileNo -> projectNo

      // contractNo -> contractNo

      // projectName -> projectName
      var data={
        projectId:item.pkId,
        projectNo:item.fileNo,
        // contractNo:item.contractNo,
        projectName:item.projectName
      }
      localStorageService.set("projectinfo",data);
      Util.goBack();
    };

    $scope.search = function(projectName) {
      param.projectName = projectName;
      $scope.taskList = new PagingService(openApi.projectlist, param);
    };
    $scope.search();
  });
